import functools
class Solution(object):
    def waysToDistribute(self, n, k):
        base = 10 ** 9 + 7
        @functools.cache
        def dfs(n, k):
            if n == k or k == 1:
                return 1
            return (dfs(n - 1, k - 1) + dfs(n - 1, k) * k) % base
        return dfs(n, k)

data = Solution()
n = 20
k = 5
print(data.waysToDistribute(n, k))